package com.alibaba.citrus.cr.mn.order.center.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * 预报单状态枚举
 */
@Getter
public enum ForecastStatusEnum {

    DRAFT(1, "待提交"),
    WAITING_FOR_REPLY(2, "待回复"),
    PARTIAL_REPLY(3, "部分回复"),
    COMPLETED(4, "已完成"),
    CANCELLED(5, "已取消"),
//    NOTACTIVE(6, "未生效"),
//    MINI_SPEC_JUDGE(120, "未知"),
    ;

    private Integer numValue;
    private String desc;

    ForecastStatusEnum(Integer numValue, String desc) {
        this.numValue = numValue;
        this.desc = desc;
    }

    public static ForecastStatusEnum of(Integer numValue) {
        return Arrays.stream(ForecastStatusEnum.values()).filter(source -> Objects.equals(numValue, source.getNumValue())).findFirst().orElse(null);
    }

    public static List<Integer> codes() {
        return Arrays.stream(ForecastStatusEnum.values()).map(ForecastStatusEnum::getNumValue).collect(Collectors.toList());
    }

}
